/// Copyright ©2021 Guangzhou Tianyi Network Information Co., Ltd. All rights reserved.
/// Project: PluginEchat
/// Created By Jisen
/// Date: 2021/8/23 下午6:56
/// Class description: ec_vis_evt - 图文消息 - VisEvt对象，访客在对话的过程中需要选择了某个需要制定的订单或者商品等，发送至客服

class ECVisEvt {
  String? eventId; // ID
  String? title; // 标题
  String? content; // 描述
  String? imageUrl; // 图片地址
  String? urlForVisitor; // 图文消息提供给访客打开的url
  String? urlForStaff; // 图文消息提供给客服打开的url，可以为空
  String? memo; // 底部备注
  int? urlEnableForVisitor; // 访客是否可点击图文消息打开设置的url，1:可打开（默认） 0:不可打开
  int? visibility; // 图文消息的可见范围.1:访客客服都可见（默认）2:只有客服可见，访客不可见
  int? customizeMsgType; // 1:访客消息 2:系统消息(默认)
  int? dedup;

  ECVisEvt({
    this.eventId,
    this.title,
    this.content,
    this.imageUrl,
    this.urlForVisitor,
    this.urlForStaff,
    this.memo,
    this.urlEnableForVisitor,
    this.visibility,
    this.customizeMsgType,
    this.dedup,
  });

  factory ECVisEvt.fromJson(Map<String, dynamic> json) {
    if (json == null) return null!;
    return ECVisEvt(
      eventId: json['eventId'],
      title: json['title'],
      content: json['content'],
      imageUrl: json['imageUrl'],
      urlForVisitor: json['urlForVisitor'],
      urlForStaff: json['urlForStaff'],
      memo: json['memo'],
      urlEnableForVisitor: json['urlEnableForVisitor'],
      visibility: json['visibility'],
      customizeMsgType: json['customizeMsgType'],
      dedup: json['dedup'],
    );
  }

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = new Map();

    if (eventId != null)
      json.putIfAbsent('eventId', () => eventId);
    if (title != null)
      json.putIfAbsent('title', () => title);
    if (content != null)
      json.putIfAbsent('content', () => content);
    if (imageUrl != null)
      json.putIfAbsent('imageUrl', () => imageUrl);
    if (urlForVisitor != null)
      json.putIfAbsent('urlForVisitor', () => urlForVisitor);
    if (urlForStaff != null)
      json.putIfAbsent('urlForStaff', () => urlForStaff);
    if (memo != null)
      json.putIfAbsent('memo', () => memo);
    if (urlEnableForVisitor != null)
      json.putIfAbsent('urlEnableForVisitor', () => urlEnableForVisitor);
    if (visibility != null)
      json.putIfAbsent('visibility', () => visibility);
    if (customizeMsgType != null)
      json.putIfAbsent('customizeMsgType', () => customizeMsgType);
    if (dedup != null)
      json.putIfAbsent('dedup', () => dedup);
    return json;
  }
}
